<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/6/27 0027
  Time: 11:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>分类管理</title>
    <script language="javascript">
        function del_sure(id) {
//            var delId = $(this).parent().find('input[class="delId"]').val();
//            var delId = $(this).siblings('.delId').val();
            var gnl = confirm("确定要删除?");
            console.log(gnl)
            if (gnl) {
                $.get("${ctx}/pcategory/category_delete?id="+id,function(){location.reload(true)})
            }
        }
        </script>
    <%--/pcategory/category_delete?id=${item.categoryId}--%>
</head>
<body>
<!-- BEGIN PAGE HEADER-->
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            信息管理 <small>商品分类管理</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/main">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="分类管理.html">
                    分类管理
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    列表
                </a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<!------内容区----->
<div class="main">

    <div class="row">
        <div class="col-md-12">
            <div class="text-right">
                <a href="${ctx}/pcategory/category_add" class="btn blue">添加分类</a>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <table class="table table-striped table-hover zqy-table">
                <thead>

                <tr>
                    <th style="width: 100px;">分类名称</th>
                    <th>层级</th>
                    <th>排序</th>
                    <th >状态</th>
                    <th style="width: 150px;">创建时间</th>
                    <th style="width: 150px;">管理分类属性</th>
                    <th style="width: 100px;">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="item" items="${course}">
                <tr>
                    <td>${item.categoryName}</td>
                    <td>${item.depth}</td>
                    <td>${item.orderNum}</td>
                    <td> <c:choose>
                        <c:when test="${item.status==0}">
                          禁用:
                        </c:when>
                        <c:when test="${item.status==1}">
                            启用
                        </c:when>
                        <c:when test="${item.status==2}">
                            删除
                        </c:when>
                    </c:choose></td>
                    <td><fmt:formatDate value="${item.createOn}" type="both"/>  </td>
                    <td><a class="btn btn-xs" href="${ctx}/category/findAllAttributeByCategoryId/${item.categoryId}">查看</a></td>
                    <td>
                        <a class="btn btn-xs" href="${ctx}/pcategory/category_modify?id=${item.categoryId}">编辑</a>
                        <a class="btn btn-xs js-deleteClassify"   onclick="javascript:del_sure('${item.categoryId}')">删除</a>
                        <%--<input type="hidden" value="${item.categoryId}" class="delId">--%>
                    </td>
                </tr>
                </c:forEach>
                </tbody>
            </table>
            <div class="text-center">
                <ul class="pagination">

                </ul>
            </div>

        </div>
    </div>

</div>
<!------[end]内容区----->
</body>
</html>
